🌎 rns.kin.earth git 🌍
Commit 5de4e24a9f8eec9f615bb3dd7edeb5a808461ccd
Parents : 5e4d32c
Author : Mark Qvist <mark@unsigned.io>
Date : 2026-01-01T21:37:56+01:00
Added await_path method to transport API
Changes
Diff
diff --git a/RNS/Transport.py b/RNS/Transport.py
index 870bfec0..df11ec56 100755
--- a/RNS/Transport.py
+++ b/RNS/Transport.py
@@ -163,6 +163,7 @@ class Transport:
inbound_announce_lock = Lock()
interface_announcer = None
discovery_handler = None
+ blackhole_updater = None
traffic_rxb = 0
traffic_txb = 0
@@ -2466,6 +2467,23 @@ class Transport:
return False
+ @staticmethod
+ def await_path(destination_hash, timeout=None, on_interface=None):
+ """
+ Requests a path to the destination from the network and
+ blocks until the path is available, or the timeout is reached.
+
+ :param destination_hash: A destination hash as *bytes*.
+ :param timeout: An optional timeout in seconds.
+ :param on_interface: If specified, the path request will only be sent on this interface. In normal use, Reticulum handles this automatically, and this parameter should not be used.
+ :returns: *True* if a path to the destination is found, otherwise *False*.
+ """
+ timeout = time.time()+(timeout if timeout else Transport.PATH_REQUEST_TIMEOUT)
+ if Transport.has_path(destination_hash): return True
+ else: Transport.request_path(destination_hash, on_interface=on_interface)
+ while not Transport.has_path(destination_hash) and time.time() < timeout: time.sleep(0.05)
+ return Transport.has_path(destination_hash)
+
@staticmethod
def request_path(destination_hash, on_interface=None, tag=None, recursive=False):
"""
Served by rngit 1.5.0 - Generated in 0.05s